package net.xrkw.server.module.client.dal.mysql.softinfo;

import java.util.*;

import net.xrkw.server.framework.common.pojo.PageResult;
import net.xrkw.server.framework.mybatis.core.query.LambdaQueryWrapperX;
import net.xrkw.server.framework.mybatis.core.mapper.BaseMapperX;
import net.xrkw.server.module.client.dal.dataobject.softinfo.SoftInfoDO;
import org.apache.ibatis.annotations.Mapper;
import net.xrkw.server.module.client.controller.admin.softinfo.vo.*;

/**
 * 软件信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface SoftInfoMapper extends BaseMapperX<SoftInfoDO> {

    default PageResult<SoftInfoDO> selectPage(SoftInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SoftInfoDO>()
                .eqIfPresent(SoftInfoDO::getCategoryId, reqVO.getCategoryId())
                .likeIfPresent(SoftInfoDO::getSoftName, reqVO.getSoftName())
                .eqIfPresent(SoftInfoDO::getVersion, reqVO.getVersion())
                .eqIfPresent(SoftInfoDO::getSize, reqVO.getSize())
                .eqIfPresent(SoftInfoDO::getPlatform, reqVO.getPlatform())
                .eqIfPresent(SoftInfoDO::getIcon, reqVO.getIcon())
                .eqIfPresent(SoftInfoDO::getDescription, reqVO.getDescription())
                .eqIfPresent(SoftInfoDO::getFeatures, reqVO.getFeatures())
                .eqIfPresent(SoftInfoDO::getInstallGuide, reqVO.getInstallGuide())
                .eqIfPresent(SoftInfoDO::getDownloadCount, reqVO.getDownloadCount())
                .eqIfPresent(SoftInfoDO::getPointsRequired, reqVO.getPointsRequired())
                .eqIfPresent(SoftInfoDO::getFileUrl, reqVO.getFileUrl())
                .eqIfPresent(SoftInfoDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(SoftInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SoftInfoDO::getId));
    }

}